﻿@model viBook.Models.User
@{
    ViewBag.Title = "User's profile";
    Layout = "~/Views/Shared/_Layout.cshtml";

    IDictionary<string, bool> selectList = new Dictionary<string, bool>();
    selectList.Add("Male", true);
    selectList.Add("Female", false);
    var returnUrl = Request.UrlReferrer != null ? Request.UrlReferrer.ToString() : Url.Action("Index", "Account");
}
<link href="../../Scripts/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/uploadify/swfobject.js" type="text/javascript"></script>
<script src="../../Scripts/uploadify/jquery.uploadify.v2.1.4.min.js" type="text/javascript"></script>
<div class="group">
    <div class="full">
        <h1>
            Edit profile</h1>
        <p>
            Edit information, avatar, etc...</p>
            @if(@Model.IsAdmin)
            {
                @Html.ActionLink("Admin Page","Index","Admins")
            }
    </div>
</div>
@using (Html.BeginForm("SaveProfile", "Account", FormMethod.Post, new { @class = "gen-form" }))
{
    <div id="main">
        @Html.Partial("_EditProfilePartial")
        @Html.HiddenFor(m => m.Id)
        @Html.HiddenFor(m => m.Username)
        <div class="form-field">
            <fieldset>
                @Html.LabelFor(m => m.Email)
                <label>@Html.DisplayFor(m => m.Email)</label>
            </fieldset>
        </div>
        <div class="form-field">
            <fieldset>
                <label for="DisplayName">
                    Display name</label>
                @Html.TextBoxFor(m => m.DisplayName, new { @class = "form-text" })
            </fieldset>
        </div>
        <div class="form-field">
            <fieldset>
                @Html.LabelFor(m => m.Location)
                @Html.TextBoxFor(m => m.Location, new { @class = "form-text" })
            </fieldset>
        </div>
        <div class="form-field">
            <fieldset>
                @Html.LabelFor(m => m.Biography)
                @Html.TextAreaFor(m => m.Biography, new { @class = "form-text" })
            </fieldset>
        </div>
        <div class="form-btns">
            <input type="submit" class="form-sub" value="Update profile" />
            <a class="form-btn" href="@returnUrl">Cancel</a>
        </div>
    </div>
    <div id="secondary">
        <h3>
            <span class="meta">Your</span> Avatar</h3>
        <div id="avatar-preview" class="group">
            <input type="hidden" id="filesUploaded" name="filesUploaded" />
            <img src="@Model.AvatarUrl" width="100" id="avatar_img" />
            <br />
            <div>
                <input id="file_upload" name="file_upload" type="file" />
                <a href="javascript:$('#file_upload').uploadifyUpload();">Upload avatar</a>
            </div>
        </div>
    </div>
}
@Html.Partial("DetailsJS")
